<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'index_left.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link rel="stylesheet" href="css/StyleSheet.css" type="text/css" />
<script src="jquery/jquery-3.1.1.js"></script>
<style type="text/css">
img {
	width: 150px;
	height: 150px;
}
</style>
	<script type="text/javascript">
		window.onload = function() {
			InitUserInfo();
			InitCategories();
			InitBlogsInfo();
		};
		/* 初始化登陆用户信息  */
		function InitUserInfo() {
			$.ajax({
				type : "POST",
				url : "blogIndex",
				success : function(msg) {
					var json = eval("(" + msg + ")");
					$('#username').html(json[0].username);
					if (json[0].gender == 1) {
						$('#gender').html('男');
					} else {
						$('#gender').html('女');
					}
				},
				error : function(r, r2, err) {
					alert("连接错误:" + err.message);
				}
			});
		}
		/* 初始化博客分类信息  */
		function InitCategories() {
			$.ajax({
				type : "POST",
				url : "categories",
				success : function(msg) {
					var json = eval("(" + msg + ")");
					for ( var i = 0; i < json.length; i++) {
						$(".ullink").append(
								"<li class='liLink'><a class='sumColor' href='#'>"
										+ json[i].name + "</a></li>");
					}

				},
				error : function(r, r2, err) {
					alert("连接错误:" + err.message);
				}
			});
		}
		/* 初始化博客信息  */
		function InitBlogsInfo() {
			$.ajax({
				type : "POST",
				url : "blogIndex!BlogsInfo",
				success : function(msg) {
					var json = eval("(" + msg + ")");
					$('img').attr('src',
							json[0].headerimage);
				},
				error : function(r, r2, err) {
					alert("连接错误:" + err.message);
				}
			});
		}
	</script>
</head>

<body>
	<div class="innerdiv">
		<ul class="ull">
			<li class="title">个人档案</li>
			<li class="ss"><img
				src="#"
				style="border-width:0px;" /></li>
			<li>姓名：<label id="username"></label>
			</li>
			<li>性别：<label id="gender"></label>
			</li>
		</ul>
	</div>
	<div class="divOther">
		<ul class="ullink">
			<li class="title">
				<h2 id="logImage2">日志分类</h2>
			</li>
		</ul>
	</div>
</body>
</html>
